// 引入发送请求的数据
import request from './request'
// 获取home页面轮播图数据
export const reqBannerList = () => {
  return request({
    url: '/mall-api/index/findBanner'
  })
}
//获取首页分类数据
export const reqCategoryList = () => {
  return request({
    url:'/mall-api/index/findCategory1'
  })
}
//获取猜你喜欢列表数据
export const reqYouLikeList = () => {
  return request({
    url:'/mall-api/index/findListGoods'
  })
}
//获取人气推荐列表数据
export const reqRecommendListDat = () => {
  return request ({
    url:'/mall-api/index/findRecommendGoods'
  })
}

//获取分类导航数据
export const reqCategoryListData = ( )=> {
  return request ({
    url:'/mall-api/index/findCategoryTree'
  })
}

//获取商品分页列表数据
export const reqGoodsListData = ({page,limit,...rest}) => {
    return request ({
      url:`/mall-api/goods/list/${page}/${limit}`,
      data:rest
    })
}

//发送请求获取临时token
export const reqTokenByCode = (code)=>{
  return request ({
    url:`/mall-api/weixin/wxLogin/${code}`
  })
}

//发送请求获取用户真正的信息
export const reqGetUesrInfo = ()=>{
  return request({
    url:"/mall-api/weixin/getuserInfo"
  })
}

//发送请求更新或者添加用户信息
export const reqUpdateOrAddUserInfo = (userInfo)=>{
  return request ({
    url:`/mall-api/weixin/updateUser`,
    method:'post',
    data: userInfo
  })
}

//发送请求获取详情页
export const reqgoodsDetail =(goodsId)=>{
  return request({
    url:`/mall-api/goods/${goodsId}`
  })
}
// 发送请求添加商品到购物车
export const reqSendGoodsCard = ({goodsId,count,blessing})=>{
  return request({
    url:`/mall-api/cart/addToCart/${goodsId}/${count}`,data:{blessing}
  })
}
// 发送请求获取购物车数据
export const reqGetCartListData = ()=>{
  return request({url:'/mall-api/cart/getCartList'})
}

// 购物车的商品选中状态
export const reqCheckCartStatus =({goodsId,isChecked})=>{
  return request({
    url:`/mall-api/cart/checkCart/${goodsId}/${isChecked}`
  })
}
// 全选与全不全
export const reqCheckedAll = (isChecked)=>{
  return request({
    url:`/mall-api/cart/checkAllCart/${isChecked}`
  })
}
// 删除购物车商品
export const reqDelteCartInfo=(goodsId)=>{
  return request({
    url:`/mall-api/cart/delete/${goodsId}`
  })
}

// 获取用户默认收货地址
export const reqDefaultAddress=()=>{
  url:'/mall-api/userAddress/getOrderAddress'
}